<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">

        <?php
      echo $html->css("nivo-slider.css");
        echo $html->css("style 2.css");
        echo $html->css("frontend.css");
        echo $html->css("jquery.wysiwyg.css");
        echo $javascript->link("jquery-1.6.1.min.js");
        echo $javascript->link("jquery.nivo.slider.pack.js");
        echo $javascript->link("jquery.wysiwyg.js");
        ?>

        <script type="text/javascript">
            $(document).ready(function(){
                $('#box_main').append('<div id="top">Back to top</div>');
                $(window).scroll(function() {
                    if($(window).scrollTop() !=0){
                        $('#top').fadeIn();
                    } else{
                        $('#top').fadeOut();	
                    }
                });	
                $('#top').click(function(){
                    $('html,body').animate({scrollTop:0},500);
                });
            });
	
            $(window).load(function() {
                $('#slider').nivoSlider();
            });
        </script>
        <style>
            .anh{
                width:300px;
                float:left;
            }
            .tin{
                width:300px;
                float:left;
            }
            }
        </style>



</head>
<body>

   

<div class="box-main">

        <div class="box-main">

            <div class="box-main-left">
                <div class="pro-content">
                    <div class="box-pro-highlights">
                        <div class="box-pro-highlights-header"> Chi Tiết Giỏ Hàng </div>
                        <div class="content">
                            <div align=center>
                                <form action="/onlinemarket/frontends/updatecart" method="post">
                                    <?php
                                    if (isset($_SESSION["cart"]) && count($session->read("cart")) > 0) {
                                        print_r("Tổng số sản phẩm: " . $session->read("tongsanpham"));
                                        echo "<br />";
                                        print_r("Tổng tiền:" . number_format($session->read("tongtien"), 0, '.', '.'));
                                        echo "<br />";
                                    }
                                    //hien thi cac sa.checkn pham trong gio hang
                                    if (isset($_SESSION["cart"]) && count($session->read("cart")) > 0) {
                                        ?>
                                        <table class="myTable" style="margin-left:5px;border-collapse: collapse;border:1px solid #CAE8EA;">
                                            <tr>
                                                <th>Ảnh</th>
                                                <th>Tên Sản Phẩm</th>
                                                <th>Giá</th>
                                                <th>Số Lượng</th>
                                                <th>Chức Năng</th>
                                            </tr>
                                            <?php
                                            foreach ($session->read("cart") as $id => $qty) {
                                                foreach ($viewcarts as $carts) {
                                                    if ($carts['Product']['id'] == $id) {
                                                        ?>
                                                        <tr>
                                                            <td align="center" width=150px><img  <img src="/onlinemarket/img/San_pham/<?php echo($carts['Product']['picture']); ?>" width="30"/></td>
                                                            <td align="center" width=150px><?php echo $carts['Product']['name'] ?></td>
                                                            <td align="center" width=150px><?php echo number_format($carts['Product']["price"], 0, ".", ".") ?></td>
                                                            <td align="center" width=150px><input style="color:#f00; width:80px;" type="text" name="<?php echo $id ?>" value="<?php echo $qty ?>"/></td>
                                                            <td><img scr="../onlinemarket/img/system/bt_delete.png" onclick='onEdit("/onlinemarket/frontends/deleteItemCart/<?php echo($carts['Product']['id']); ?>")' />xoa </td>
                                                        </tr>
                                                    <?php
                                                    }
                                                }
                                            }
                                            ?>
                                        </table>
                                        <table>
                                            <tr><td><input style="background:url('/onlinemarket/img/system/updatecart.gif');width:100px;height: 21px;border:none;" type="submit" value="" /></td>
                                                <td><a href="/onlinemarket/frontends/deleteCart" ><img src="/onlinemarket/img/system/remove.jpg"/></a>
                                            </tr>
                                        </table>

                                    </form>
                                <form action="/onlinemarket/orders/saveorder" method="POST">
                                    <fieldset class="create-form">
                <legend>Thông tin thanh toán</legend>
                                    <table>
                                        <tr>
                                            <td>Phương thức thanh toán: </td>
                                            <td>
                                                <select name="paymethod">
                                                    <?php foreach($ListPayMethod as $pay){ ?>
                                                    <option value="<?php echo $pay['Paymethod']['id'] ?>"><?php echo $pay["Paymethod"]["name"] ?></option>
                                                    <?php } ?>
                                                </select>
                                            </td>                                            
                                        </tr>
                                        <tr>
                                            <td>Miêu tả: </td>
                                            <td>
                                                <textarea name="description" rows="8" cols="30"></textarea>
                                            </td>
                                        </tr>
                                    </table>
                                    <input type="submit" name="submit" value="Thanh toán"/>
                                </form>
</fieldset>
                                    <?php
                                } else {
                                    ?>
        								Giỏ hàng bạn đang rỗng !
<?php } ?>
                            </div>
                            <script>
                                function onEdit(link) {
					
                                    window.location = ""+link;
                                }
                            </script>
                        </div>
                    </div>
                </div><!--end div.box-pro-highlights-->
            </div><!--end div.pro-content-->
        </div><!--end div.box-main-left-->
        <div class="box-main-right" style="margin: 0px;"></div><!--end div.box-main-right-->

    </div><!--end div.box-main-->

    <div class="box_footer">

    </div><!--end div.footer-->
</body>
</html>